package com.bdqn.demo03;

import java.lang.reflect.Proxy;

/**
 * JDKProxyFactory
 *
 * @author LILIBO
 * @since 2021-12-02
 */
public class JDKProxyFactory {

    public static <T> T create(Object target) {
        JDKInvocationHandler handler = new JDKInvocationHandler();
        handler.setTarget(target);
        return (T) Proxy.newProxyInstance(target.getClass().getClassLoader(), target.getClass().getInterfaces(), handler);
    }
}
